<html>
<head>
<title>Detailed view for stations</title>
</head>

<STYLE TYPE="text/css">
  td { width: 300px; }
</STYLE>

<body>
  <?php include("./header.php"); ?>

  <div>
    <form action="SaveComputerDetailChanges.php" method="post">
      <table cellspacing="0" border="1" style="background-color: #DADADA">
        <?php
          $con = get_connection();
          
          $id = $_GET['computer_id'];        
          $result = mysql_query('call GetComputerDetail('.$id.')') or die( mysql_error() );
          
          if ($result)
          {  
            $row = mysql_fetch_array($result);
            mysql_close($con);

            echo('<tr><td>PC name: </td><td>' . $row[1] . '</td></tr>');
            echo('<tr><td>Room: </td><td>' . $row[2] . '</td></tr>');
            echo('<tr><td>Administrator: </td><td>' . $row[3] . '</td></tr>');
            echo('<tr><td>Operational: </td><td>' . ($row[4] == chr(0x01) ? 'Yes' : 'No') . '</td></tr>');
            echo('<tr><td>Type: </td><td>' . ($row[5] == chr(0x01) ? 'Server' : 'Client') . '</td></tr>');
            
            $con = get_connection();
            
            $domRes = mysql_query('call GetDomainsOfComputer('.$id.')') or die(mysql_error());
            if($domRes)
            {
              echo('<tr><td>Included in domains: </td><td><table>');
              while($domRow = mysql_fetch_array($domRow))
              {
                echo '<tr><td width="85%">' . $domRow[1] . '</td><td width="15%"><a href="ComputerDetails.php?computer_id=' . $id . '&excludeDonainId=' . $domRow[0] . '">exclude</a></td></tr>';
              }
              echo('</table></td><tr>');
            }
           	mysql_close($con);
            
            echo('<tr style="background-color: #FFCC33;"><td colspan="2">Product details</td></tr>');
            echo('<tr><td>Coniguration: </td><td>' . $row[6] . '</td></tr>');
            echo('<tr><td>Purchase date: </td><td>' . $row[8] . '</td></tr>');
            echo('<tr><td>Warranty (months): </td><td>' . $row[9] . '</td></tr>');
            echo('<tr><td>Price (Eur): </td><td>' . $row[7] . ',-</td></tr>');
            echo('<tr><td>Supplier: </td><td>' . $row[10] . '</td></tr>');
          }
        ?>
      </table>
    </form>
  </div>
</body>
</html>
